AI-Powered Research with Jina AI Deep Search

工作流概述

这是一个包含6个节点的中等工作流,主要用于自动化处理各种任务。

工作流源代码

下载
{
  "id": "GToc9QTzJY1h1w3y",
  "meta": {
    "instanceId": "cba4a4a2eb5d7683330e2944837278938831ed3c042e20da6f5049c07ad14798",
    "templateCredsSetupCompleted": true
  },
  "name": "AI-Powered Research with Jina AI Deep Search",
  "tags": [],
  "nodes": [
    {
      "id": "c76a7993-e7b1-426e-bcb4-9a18d9c72b83",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -820,
        -140
      ],
      "parameters": {
        "color": 6,
        "width": 740,
        "height": 760,
        "content": "
# **🚀 Developed by Leonard van Hemert**  

Thank you for using **FREE: Open Deep Research 2.0**! 🎉  

This workflow was created to **democratize AI-powered research** and make advanced **automated knowledge discovery** available to **everyone**, without **API restrictions** or **cost barriers**.  

If you find this useful, feel free to **connect with me on LinkedIn** and stay updated on my latest AI & automation projects!  

🔗 **Follow me on LinkedIn**: [Leonard van Hemert](https://www.linkedin.com/in/leonard-van-hemert/)  

I truly appreciate the support from the **n8n community**, and I can’t wait to see how you use and improve this workflow! 🚀  

Happy researching,  
**Leonard van Hemert** 💡"
      },
      "typeVersion": 1
    },
    {
      "id": "5620b6b5-1485-43a8-9acd-3368147bd742",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -60,
        -140
      ],
      "parameters": {
        "width": 740,
        "height": 300,
        "content": "## 🚀 **FREE: Open Deep Research 2.0**  
Fully automated **AI-powered research workflow** using **Jina AI’s DeepSearch** to generate structured, fact-based reports—**no API key required!**  "
      },
      "typeVersion": 1
    },
    {
      "id": "dbe1cc91-34b4-4e5b-b404-dd86f47d1ebf",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -60,
        180
      ],
      "parameters": {
        "width": 740,
        "height": 440,
        "content": "## 🧠 **How This Workflow Works**  

This workflow automates **deep research and report generation** using **Jina AI's DeepSearch API**, making **advanced knowledge discovery accessible for free**.  

1️⃣ **User Input → AI Research**  
- A user **enters a research query** via chat.  
- The workflow **sends the query** to **Jina AI’s DeepSearch API** for **in-depth analysis**.  

2️⃣ **AI-Powered Insights**  
- DeepSearch **retrieves** and **analyzes** relevant information.  
- The response includes **key insights, structured analysis, and sources**.  

3️⃣ **Markdown Formatting & Cleanup**  
- The response **passes through a Code Node** that extracts, cleans, and **formats** the AI-generated insights into **readable Markdown output**.  
- URLs are properly formatted, footnotes are structured, and the report is easy to read.  

4️⃣ **Final Output**  
- The final, **well-structured research report** is ready for use, **fully automated and free of charge!**  "
      },
      "typeVersion": 1
    },
    {
      "id": "42fd2f04-7d83-44c9-a41b-48860efbcf79",
      "name": "Jina AI DeepSearch Request",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        220,
        0
      ],
      "parameters": {
        "url": "https://deepsearch.jina.ai/v1/chat/completions",
        "method": "POST",
        "options": {},
        "jsonBody": "={
  \"model\": \"jina-deepsearch-v1\",
  \"messages\": [
    {
      \"role\": \"user\",
      \"content\": \"You are an advanced AI researcher that provides precise, well-structured, and insightful reports based on deep analysis. Your responses are factual, concise, and highly relevant.\"
    },
    {
      \"role\": \"assistant\",
      \"content\": \"Hi, how can I help you?\"
    },
    {
      \"role\": \"user\",
      \"content\": \"Provide a deep and insightful analysis on: \\"{{ $json.chatInput }}\\". Ensure the response is well-structured, fact-based, and directly relevant to the topic, with no unnecessary information.\"
    }
  ],
  \"stream\": true,
  \"reasoning_effort\": \"low\"
}",
        "sendBody": true,
        "specifyBody": "json"
      },
      "typeVersion": 4.2
    },
    {
      "id": "1b7b3bbe-2068-4d3a-a962-134bbb6ee516",
      "name": "User Research Query Input",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        0,
        0
      ],
      "webhookId": "8a4b05af-cd63-4692-9924-e35aaed5f077",
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "218cbfe2-78de-4b00-875a-51761ac9f5c7",
      "name": "Format & Clean AI Response",
      "type": "n8n-nodes-base.code",
      "position": [
        440,
        0
      ],
      "parameters": {
        "jsCode": "function extractAndFormatMarkdown(input) {
    let extractedContent = [];

    // Extract raw data string from n8n input
    let rawData = input.first().json.data;

    // Split into individual JSON strings
    let jsonStrings = rawData.split(\"\n\ndata: \").map(s => s.replace(/^data: /, ''));

    let lastContent = \"\";
    
    // Reverse loop to find the last \"content\" field
    for (let i = jsonStrings.length - 1; i >= 0; i--) {
        try {
            let parsedChunk = JSON.parse(jsonStrings[i]);

            if (parsedChunk.choices && parsedChunk.choices.length > 0) {
                for (let j = parsedChunk.choices.length - 1; j >= 0; j--) {
                    let choice = parsedChunk.choices[j];

                    if (choice.delta && choice.delta.content) {
                        lastContent = choice.delta.content.trim();
                        break;
                    }
                }
            }

            if (lastContent) break; // Stop once the last content is found
        } catch (error) {
            console.error(\"Failed to parse JSON string:\", jsonStrings[i], error);
        }
    }

    // Clean and format Markdown
    lastContent = lastContent.replace(/\[\^(\d+)\]: (.*?)\n/g, \"[$1]: $2\n\");  // Format footnotes
    lastContent = lastContent.replace(/\[\^(\d+)\]/g, \"[^$1]\");  // Inline footnotes
    lastContent = lastContent.replace(/(https?:\/\/[^\s]+)(?=[^]]*\])/g, \"<$1>\");  // Format links

    // Return formatted content as an array of objects (n8n expects this format)
    return [{ text: lastContent.trim() }];
}

// Execute function and return formatted output
return extractAndFormatMarkdown($input);
"
      },
      "typeVersion": 2
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "e03d69b5-3304-4f28-b99f-970d6fd1225b",
  "connections": {
    "User Research Query Input": {
      "main": [
        [
          {
            "node": "Jina AI DeepSearch Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format & Clean AI Response": {
      "main": [
        []
      ]
    },
    "Jina AI DeepSearch Request": {
      "main": [
        [
          {
            "node": "Format & Clean AI Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

功能特点

  • 自动检测新邮件
  • AI智能内容分析
  • 自定义分类规则
  • 批量处理能力
  • 详细的处理日志

技术分析

节点类型及作用

  • Stickynote
  • Httprequest
  • @N8N/N8N Nodes Langchain.Chattrigger
  • Code

复杂度评估

配置难度:
★★★☆☆
维护难度:
★★☆☆☆
扩展性:
★★★★☆

实施指南

前置条件

  • 有效的Gmail账户
  • n8n平台访问权限
  • Google API凭证
  • AI分类服务订阅

配置步骤

  1. 在n8n中导入工作流JSON文件
  2. 配置Gmail节点的认证信息
  3. 设置AI分类器的API密钥
  4. 自定义分类规则和标签映射
  5. 测试工作流执行
  6. 配置定时触发器(可选)

关键参数

参数名称 默认值 说明
maxEmails 50 单次处理的最大邮件数量
confidenceThreshold 0.8 分类置信度阈值
autoLabel true 是否自动添加标签

最佳实践

优化建议

  • 定期更新AI分类模型以提高准确性
  • 根据邮件量调整处理批次大小
  • 设置合理的分类置信度阈值
  • 定期清理过期的分类规则

安全注意事项

  • 妥善保管API密钥和认证信息
  • 限制工作流的访问权限
  • 定期审查处理日志
  • 启用双因素认证保护Gmail账户

性能优化

  • 使用增量处理减少重复工作
  • 缓存频繁访问的数据
  • 并行处理多个邮件分类任务
  • 监控系统资源使用情况

故障排除

常见问题

邮件未被正确分类

检查AI分类器的置信度阈值设置,适当降低阈值或更新训练数据。

Gmail认证失败

确认Google API凭证有效且具有正确的权限范围,重新进行OAuth授权。

调试技巧

  • 启用详细日志记录查看每个步骤的执行情况
  • 使用测试邮件验证分类逻辑
  • 检查网络连接和API服务状态
  • 逐步执行工作流定位问题节点

错误处理

工作流包含以下错误处理机制:

  • 网络超时自动重试(最多3次)
  • API错误记录和告警
  • 处理失败邮件的隔离机制
  • 异常情况下的回滚操作